home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 5 / BBS in a Box -Volume V (BBS in a Box) (April 1992).iso / Files / Hyper / Co-Cz / Countdown.cpt / Countdown / stack.txt < prev   
Encoding:
Text File  |  1987-12-19  |  8.7 KB  |  428 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x0 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 2
  11. -- first background id: 2649
  12. -- card count: 4
  13. -- first card id: 2968
  14. -- list block id: 2184
  15. -- print block id: 0
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 0
  19. -- free size: 0 bytes
  20. -- total size: 38176 bytes
  21. -- stack block size: 7680 bytes
  22. -- created by hypercard version: 0x00000000
  23. -- compacted by hypercard version: 0x00000000
  24. -- modified by hypercard version: 0x00000000
  25. -- opened by hypercard version: 0x00000000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. on openStack      -- initial setup
  69.   global NeedPack
  70.   put false into NeedPack
  71.   hide menubar
  72. end openstack
  73. on closeStack
  74.   global NeedPack
  75.   choose browse tool
  76.   if NeedPack then
  77.     put the userLevel into OldLevel
  78.     set the userLevel to 4
  79.     set the location of message to 22,14
  80.     show message
  81.     put "Recovering Free Space From Stack" into Message
  82.     doMenu "Compact Stack"
  83.     hide message
  84.     set the location of message to 16,216
  85.     set the userLevel to OldLevel
  86.   end if
  87.   show menubar
  88. end closeStack
  89.  
  90. on RunClock        -- this paragraph does it all
  91.   global TestRun
  92.   set cursor to 4
  93.   hide menuBar
  94.   Put the userLevel into OldLevel
  95.   Set the userLevel to 4
  96.   if OldLevel > 2 or the number of cards <> 5 then SetupClock1
  97.   SetupClock2
  98.   SetTZero
  99.   set lockScreen to false
  100.   visual effect dissolve
  101.   go to card 4
  102.   if TestRun then DoTest
  103.   else DoClock
  104.   Set the userLevel to OldLevel
  105.   go to card 1
  106. end RunClock
  107.  
  108. on DoClock    -- do the clock countdown
  109.   global TZero, SL
  110.   put 0 into TNow
  111.   put 1 into SL
  112.   repeat until SL <= 0 or the mouse is down
  113.     if the seconds <> TNow then
  114.       put the seconds into TNow
  115.       put TZero - TNow into SL
  116.       dSL
  117.     end if
  118.   end repeat
  119.   if the mouse is up then dZero
  120. end DoClock
  121.  
  122. on SetTZero
  123.   global TZero
  124.   go to card 1
  125.   put card field hours into H
  126.   if H = 12 then put 0 into H
  127.   if the hilite of button PM = true then add 12 to H
  128.   put the seconds into TZero
  129.   convert TZero to dateItems
  130.   put H into item 4 of TZero
  131.   put card field minutes into item 5 of TZero
  132.   put 0 into item 6 of TZero
  133.   convert TZero to seconds
  134.   if TZero < the seconds then add 86400 to TZero
  135. end SetTZero
  136.  
  137. on DoTest       -- perform a test run
  138.   global SL
  139.   put 10362 into SL
  140.   dSL
  141.   wait 3 seconds
  142.   put 2456 into SL
  143.   dSL
  144.   wait 3 seconds
  145.   put 28 into SL
  146.   dSL
  147.   wait 3 seconds
  148.   hide card field 1
  149.   hide card field 2
  150.   d5
  151.   wait 30
  152.   d4
  153.   wait 30
  154.   d3
  155.   wait 30
  156.   d2
  157.   wait 30
  158.   d1
  159.   wait 30
  160.   d0
  161.   dZero
  162. end DoTest
  163.  
  164. on SetupClock1     -- create & initilize cards 4 & 5
  165.   global NeedPack
  166.   put true into NeedPack
  167.   set the location of message to 22,14
  168.   show message
  169.   put "SETUP: 1 of 5 - Deleting Old Card 5" into Message
  170.   repeat while the number of cards > 4
  171.     go to card 5
  172.     doMenu "Delete Card"
  173.   end repeat
  174.   put "SETUP: 2 of 5 - Creating Card 5" into Message
  175.   go to card 4
  176.   doMenu "New Card"
  177.   go to card 3
  178.   choose field tool
  179.   click at the location of card field 1
  180.   doMenu "Copy Field"
  181.   go to card 5
  182.   doMenu "Paste Field"
  183.   set the location of card field 1 to 256,171
  184.   set showLines of card field 1 to false
  185.   set style of card field 1 to transparent
  186.   put "SETUP: 3 of 5 - Setting Card 4 Fields" into Message
  187.   go to card 4
  188.   show card field 1
  189.   show card field 2
  190.   choose field tool
  191.   click at the location of card field 2
  192.   doMenu "Clear Field"
  193.   go to card 2
  194.   click at the location of card field 1
  195.   doMenu "Copy Field"
  196.   go to card 4
  197.   doMenu "Paste Field"
  198.   choose browse tool
  199.   set the location of card field 2 to 256,68
  200.   set style of card field 2 to transparent
  201.   set showLines of card field 2 to false
  202. end SetupClock1
  203.  
  204. on SetupClock2     -- finish set up of  cards 4 & 5
  205.   set the location of message to 22,14
  206.   show message
  207.   put "SETUP: 4 of 5 - Updating background for Card 5" into Message
  208.   go to card 5
  209.   doMenu "Background"
  210.   choose select tool
  211.   doMenu "Select All"
  212.   doMenu "Copy Picture"
  213.   doMenu "Background"
  214.   doMenu "Paste Picture"
  215.   choose browse tool
  216.   put card field 1 of card 3 into card field 1
  217.   put "SETUP: 5 of 5 - Updating Card 4 Message" into Message
  218.   go to card 4
  219.   hide button 1
  220.   hide button 2
  221.   hide button 3
  222.   hide button 4
  223.   hide button 5
  224.   hide button 6
  225.   hide button 7
  226.   hide button 8
  227.   show card field 1
  228.   show card field 2
  229.   put card field 1 of card 2 into card field 2
  230.   put empty into card field 1
  231.   -- all done! --
  232.   hide message
  233.   set the location of message to 16,216
  234. end SetupClock2
  235.  
  236. on dSL           -- display the time left....
  237.   global SL
  238.   if SL < 20 then
  239.     hide card field 1
  240.     hide card field 2
  241.     if SL < 10 then
  242.       hide button 8
  243.       d90
  244.     else
  245.       show button 8
  246.       subtract 10 from SL
  247.       d90
  248.       add 10 to SL
  249.     end if
  250.   else
  251.     if SL < 60 then
  252.       dS
  253.     else
  254.       if SL < 3600 then dMS
  255.       else
  256.         DHMS
  257.       end if
  258.     end if
  259.   end if
  260. end dSL
  261.  
  262. on dHMS
  263.   global SL
  264.   put trunc(SL/3600) into H
  265.   put trunc(SL/60 - H * 60) into M
  266.   if M < 10 then put "0" before M
  267.   put SL - H * 3600 - M * 60 into S
  268.   put H & ":" & M & return & S into card field 1
  269. end dHMS
  270.  
  271. on dMS
  272.   global SL
  273.   put trunc(SL/60) into M
  274.   put SL - M * 60 into S
  275.   put M & " Min." & return & S & " Sec." into card field 1
  276. end dMS
  277.  
  278. on dS
  279.   global SL
  280.   put SL & " Seconds" into card field 1
  281. end ds
  282.  
  283.  
  284. -- display final 10 seconds --
  285. on d90
  286.   global SL
  287.   if SL = 0 then d0
  288.   if SL = 1 then d1
  289.   if SL = 2 then d2
  290.   if SL = 3 then d3
  291.   if SL = 4 then d4
  292.   if SL = 5 then d5
  293.   if SL = 6 then d6
  294.   if SL = 7 then d7
  295.   if SL = 8 then d8
  296.   if SL = 9 then d9
  297. end d90
  298.  
  299. on d9
  300.   show button 1
  301.   hide button 2
  302.   show button 3
  303.   show button 4
  304.   show button 5
  305.   show button 6
  306.   show button 7
  307. end d9
  308.  
  309. on d9
  310.   show button 1
  311.   hide button 2
  312.   show button 3
  313.   show button 4
  314.   show button 5
  315.   show button 6
  316.   show button 7
  317. end d9
  318.  
  319. on d8
  320.   show button 1
  321.   show button 2
  322.   show button 3
  323.   show button 4
  324.   show button 5
  325.   show button 6
  326.   show button 7
  327. end d8
  328.  
  329. on d7
  330.   hide button 1
  331.   hide button 2
  332.   show button 3
  333.   show button 4
  334.   show button 5
  335.   hide button 6
  336.   hide button 7
  337. end d7
  338.  
  339. on d6
  340.   show button 1
  341.   show button 2
  342.   hide button 3
  343.   show button 4
  344.   show button 5
  345.   show button 6
  346.   show button 7
  347. end d6
  348.  
  349. on d5
  350.   show button 1
  351.   hide button 2
  352.   hide button 3
  353.   show button 4
  354.   show button 5
  355.   show button 6
  356.   show button 7
  357. end d5
  358.  
  359. on d4
  360.   show button 1
  361.   hide button 2
  362.   show button 3
  363.   show button 4
  364.   hide button 5
  365.   show button 6
  366.   hide button 7
  367. end d4
  368.  
  369. on d3
  370.   hide button 1
  371.   hide button 2
  372.   show button 3
  373.   show button 4
  374.   show button 5
  375.   show button 6
  376.   show button 7
  377. end d3
  378.  
  379. on d2
  380.   hide button 1
  381.   show button 2
  382.   show button 3
  383.   hide button 4
  384.   show button 5
  385.   show button 6
  386.   show button 7
  387. end d2
  388.  
  389. on d1
  390.   hide button 1
  391.   hide button 2
  392.   show button 3
  393.   show button 4
  394.   hide button 5
  395.   hide button 6
  396.   hide button 7
  397. end d1
  398.  
  399. on d0
  400.   show button 1
  401.   show button 2
  402.   show button 3
  403.   show button 4
  404.   show button 5
  405.   hide button 6
  406.   show button 7
  407. end d0
  408.  
  409. on dZero      -- display the zero message card
  410.   global TestRun
  411.   go to card 5
  412.   choose select tool
  413.   doMenu "Select All"
  414.   if TestRun then put 11 into x
  415.   else put 121 into x
  416.   repeat while the mouse is up
  417.     if x > 0 then
  418.       doMenu "Invert"
  419.       subtract 1 from x
  420.     else
  421.       choose browse tool
  422.     end if
  423.   end repeat
  424.   choose browse tool
  425. end dZero
  426.  
  427.  
  428.